Raspberry Pi Assembly Language RISC OS Beginners (Hands On Guide) by Bruce Smith

Raspberry Pi Assembly Language RISC OS Beginners (Hands On Guide) by Bruce Smith

Author:Bruce Smith [Smith, Bruce]
Language: eng
Format: epub
Publisher: BSB
Published: 2014-02-17T05:00:00+00:00


The EQUB 0 operator is the standard way of marking the end of a string. The ALIGN directive is used to reset the word boundary to allow the rest of the program to assemble. The lines in 240 and 250 do nothing other than to illustrate the point. A good habit to get into is to use ALIGN at the end of any sections of data storage. It does not slow your program down in any way and is good housekeeping.

Call Parameters

To this point we have used the CALL command in its simplest form:

CALL start

This will execute a machine code program located at ‘start’. On passing control from BBC BASIC to the machine code, the values in BBC BASIC’s integer variables A% to H% are placed in registers R0 to R7 respectively. However, CALL can do much more. The format of the CALL command is:

CALL <Expression> (,Variable(s)...)

Here, ‘Expression’ is the address of the routine to be called. It can be a variable holding the address, it can be the address itself or it can be a calculated value giving the address. Beyond this, separated by commas can be multiple variables, or immediate values which will be passed into the program. The variables may be of any type, but they must exist when the CALL statement is executed. For example:

CALL start, B$, value%, count

On execution BBC BASIC confirms that all parameters exist and then seeds various registers with the details of a parameter block which BBC BASIC has constructed before entering the CALLed address. Figure 18c defines the format of this parameter block.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.